<?php
class APIUserRoleManagerFactory {

    private static $userRoleManager = null;

    private static $authenticationService = null ;

    public static function getUserRoleManager() {

        if (empty(self::$userRoleManager)) {
            $userRoleManagerService = new UserRoleManagerService();
            if (isset(self::$authenticationService)) {
                $userRoleManagerService->setAuthenticationService(self::$authenticationService) ;
            }
            self::$userRoleManager = $userRoleManagerService->getUserRoleManager();
        }
        return self::$userRoleManager;
    }

    public static function setAuthenticationService ($authenticationService ) {
        self::$authenticationService = $authenticationService ;
    }

}